Skip to content

fix: pin Redoc CDN to @2 instead of @latest#12

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/elegant-edison-b9gytr
Open

fix: pin Redoc CDN to @2 instead of @latest#12
dmchaledev wants to merge 1 commit into
mainfrom
claude/elegant-edison-b9gytr

Conversation

@dmchaledev

Copy link
Copy Markdown
Contributor

Problem

docs/index.html loads Redoc from jsDelivr using the @latest tag:

<script src="https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js"></script>

This creates two risks:

  1. Breaking changes. If Redoc ships a v3 with breaking changes, @latest will resolve to it automatically — silently breaking the public API reference with no code change on our end.
  2. Can't add Subresource Integrity (SRI). SRI requires a fixed, known hash for the script. @latest resolves to different files over time, making it impossible to add an integrity="sha384-..." attribute. Without SRI, a compromised CDN could serve malicious JavaScript to anyone visiting the docs.

Fix

Pin to @2 — the current stable major series — so we stay on 2.x patch/minor updates while being immune to a future v3 major bump:

<script src="https://cdn.jsdelivr.net/npm/redoc@2/bundles/redoc.standalone.js"></script>

jsDelivr resolves @2 to the latest 2.x.x release, so we still get security and bug-fix updates within the major version.

Follow-up

Once comfortable pinning to an exact patch version (e.g. redoc@2.1.3), add a crossorigin="anonymous" attribute and an integrity="sha384-..." SRI hash to fully protect against CDN-level supply chain attacks.

Test plan


Generated by Claude Code

Using @latest risks silent breakage if Redoc ever ships a v3 with
breaking changes, and makes it impossible to add Subresource Integrity
(SRI) since the resolved file hash changes on every release.

Pinning to @2 keeps the docs on the current stable major series while
allowing patch/minor updates, and is a prerequisite for adding an
`integrity` attribute in a follow-up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet